"""
*args: positional arguments   位置参数
**kwargs: keyword arguments   关键词参数
1.*args代表任何多个无名参数，返回的是元组；
  **kwargs表示关键字参数，所有传入的参数形式为key=value，返回字典
2.位置参数在关键词参数前面
"""


def this_fun01(*args, **kwargs):
    print(args)
    print(kwargs)


this_fun01(1, 2, index1=11, index2=22)
"""
结果：
(1, 2)
{'index1': 11, 'index2': 22}
"""

print('-----------------------------------------------------------------------')


def this_fun02(a, b, *args, **kwargs):
    print(a)
    print(b)
    print(args)
    print(kwargs)


this_fun02(0, 1, 2, 3, index1=11, index2=22)
"""
结果：
0
1
(2, 3)
{'index1': 11, 'index2': 22}
"""
print('-----------------------------------------------------------------------')


def this_fun3(**searchProperties):
    print(searchProperties)
    for k, v in searchProperties.items():
        print(k, v)
    ControlTypeNames = dict()
    strs = ['{}: {}'.format(k, ControlTypeNames[v] if k == 'ControlType' else repr(v)) for k, v in
            searchProperties.items()]
    print(strs)
    print('{' + ', '.join(strs) + '}')


this_fun3(name='lifeng', age=18, heght=167)
"""
结果：
{'name': 'lifeng', 'age': 18, 'heght': 167}
name lifeng
age 18
heght 167
["name: 'lifeng'", 'age: 18', 'heght: 167']
{name: 'lifeng', age: 18, heght: 167}

"""
data = {'index1': 11, 'index2': 22}


def this_fun4(**data):
    print(data)


this_fun4(**data)
